home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / pcc / v05n02 / batspt.bas < prev    next >
BASIC Source File  |  1991-10-27  |  901b  |  38 lines

  1. REM Batsplit.bas
  2. REM Next 2 lines should be adjusted for a given system.
  3. INFILE$ = "C:\BATFILES"
  4. OUTDIR$ = "D:\BATCH\"     
  5. TRUE = -1
  6. FALSE = 0
  7. OUTFLAG% = FALSE
  8. WRITEFLAG% = FALSE
  9. OUTCOUNT% = 0
  10. OPEN INFILE$ FOR INPUT AS #1
  11. DO
  12.    LINE INPUT #1, L$
  13.    IF LEFT$(UCASE$(L$), 6) = "START " THEN
  14.       IF OUTFLAG% THEN
  15.          CLOSE #2
  16.       END IF
  17.       OUTFLAG% = TRUE
  18.       WRITEFLAG% = FALSE
  19.       OUTFILE$ = OUTDIR$ + RIGHT$(L$, LEN(L$) - 6)
  20.       OPEN OUTFILE$ FOR OUTPUT AS #2
  21.       OUTCOUNT% = OUTCOUNT% + 1
  22.    ELSEIF LEFT$(UCASE$(L$), 4) = "END " THEN
  23.       IF OUTFLAG% THEN
  24.          CLOSE #2
  25.       END IF
  26.       OUTFLAG% = FALSE
  27.       WRITEFLAG% = FALSE
  28.    ELSE
  29.       WRITEFLAG% = TRUE
  30.    END IF
  31.    IF OUTFLAG% AND WRITEFLAG% THEN
  32.       PRINT #2, L$
  33.    END IF
  34. LOOP UNTIL (EOF(1))
  35. PRINT OUTCOUNT%; "batch files in "; INFILE$; " written to "; OUTDIR$
  36. SYSTEM
  37. END
  38.